package com.cy.bfzcommons.web.util;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.util.StringUtil;

import javax.servlet.http.HttpServletRequest;


public class PageUtil {
    public static <T> Page<T> startpage(){
        HttpServletRequest request = ServletUtil.getRequest ();     //获取requset

        String pageSizestr = request.getParameter ("pageSize");
        String pageCurrentstr = request.getParameter ("pageCurrent");

        Integer pageSize = StringUtil.isEmpty (pageSizestr)?10:Integer.parseInt (pageSizestr);
        Integer pageCurrent = StringUtil.isEmpty (pageCurrentstr)?1:Integer.parseInt (pageCurrentstr);

        return PageHelper.startPage (pageCurrent,pageSize);

    }

}
